package org.komarichin.services;

import org.komarichin.beans.IBlog;
import org.komarichin.beans.IComment;
import org.komarichin.beans.IPost;
import org.komarichin.beans.dao.IBloggerDAO;
import org.komarichin.beans.service.IBloggerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

/**
 * User: Mykhaylo Komarichyn
 * Date: 19.03.2010
 * Time: 15:34:55
 */
@Service
public class BloggerService implements IBloggerService<String> {
    private static final long serialVersionUID = -5347038283897899519L;

    private static final Logger log = LoggerFactory.getLogger(BloggerService.class);
    @Autowired
    private IBloggerDAO<String> bloggerDAO;

    @Override
    public void createComment(IComment comment, String postId) {
        bloggerDAO.createComment(comment, postId);
    }

    @Override
    public void createPost(IPost post) {
        bloggerDAO.createPost(post);
    }

    @Override
    public Collection<IComment> getComments(String postId) {
        return bloggerDAO.getComments(postId);
    }

    @Override
    public Collection<IPost> getPosts() {
        return bloggerDAO.getPosts();
    }

    @Override
    public IBlog getBlog() {
        return bloggerDAO.getBlog();
    }

    @Override
    public IPost<String> getPost(String postId) {
        return bloggerDAO.getPost(postId);
    }

    @Override
    public Collection<IPost> getLatestPost() {
        return bloggerDAO.getLatestPost();
    }
}
